<template>
  <div class="record">
    <van-swipe
      :width="(150 / 375) * windowWidth"
      :show-indicators="false"
      :loop="false"
    >
      <van-swipe-item v-for="(item, index) in list" :key="index">
        <doctor-card :item="item" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import DoctorCard from './DoctorCard.vue'
import ke from '@/assets/user/S2.png'

export default {
  components: {
    DoctorCard,
  },
  data() {
    return {
      list: [
        { name: '201638300111蒋依婷实习生课堂实录1', img: ke },
        { name: '201638300111蒋依婷实习生课堂实录1', img: ke },
        { name: '201638300111蒋依婷实习生课堂实录1', img: ke },
        { name: '201638300111蒋依婷实习生课堂实录1', img: ke },
        { name: '201638300111蒋依婷实习生课堂实录1', img: ke },
      ],
      windowWidth: window.innerWidth,  // 初始值设为当前窗口宽度
    }
  },

  mounted() {
    // 在组件挂载后监听窗口大小变化
    window.addEventListener('resize', this.handleResize)
  },
  beforeDestroy() {
    // 在组件销毁前移除事件监听器
    window.removeEventListener('resize', this.handleResize)
  },



  
  methods: {
    handleResize() {
      // 更新 windowWidth 数据
      this.windowWidth = window.innerWidth
    },
  },
};
</script>

<style lang="scss" scoped>
.record {
  width: 100%;
  height: 147px;
}
</style>